package com.healthy.service;

import com.healthy.entity.Customertest;
import com.healthy.mapper.CustomertestMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CustomertestService {
    @Autowired
    CustomertestMapper customertestMapper;
//    查询全部
    public List<Customertest> cuList(){
        return customertestMapper.culist();
    }
    //    添加
    public Customertest cuInsert(Customertest customertest) {

        customertestMapper.cuInsert(customertest);
        return customertest;
    }

    //    删除
    public int cuDeleteByid(int id) throws Exception {
        int res = customertestMapper.cuDeleteByid(id);
        if (res > 0) {
            return 1;
        } else {
            return 0;
        }
    }
    //    修改
    public int cuUpdateByid(int id,String name,String startime,String endtime,String content) throws Exception {
        int res = customertestMapper.cuUpdateByid(id,name,startime,endtime,content);
        if (res > 0) {
            return 1;
        } else {
            return 0;
        }
    }
}
